<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>经纪人-确认签约订单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <link rel="stylesheet" href="../css/mui.min.css">

    <link rel="stylesheet" href="../js/loding/loding.css">

    <link rel="stylesheet" type="text/css" href="../WebUploader/font-awesome.min.css">
    <!--引入JS-->

    <script src="../js/loding/loading.js"></script>
    <script src="../uploader/js/jquery.js"></script>
    <script src="../uploader/js/lrz.bundle.js"></script>
    <script src="../uploader/js/upload.js"></script>
    <!--引入JS-->
    <style>
        li{
            list-style-type:none;
            width:150px;
        }
        label{
            font-size: 12px!important;
        }
        input{
            font-size: 12px!important;
        }
    </style>
</head>
<body>
<div class="mui-content" >
    <div class="headage"></div>
    <div class="container">
        <form class="mui-input-group" style="height: 780px">
            <div class="mui-input-row ">
                <label>合同差价:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="totalprice">
            </div>
            <div class="mui-input-row ">
                <label>合同照片:</label>
            </div>

            <div class="mui-input-row " style="height: 180px;">
                <ul style="width: 100%;height: 160px;">
                    <li style="float: left;width: 50%">
                        <div id="drop_area0"></div>
                    </li>
<!--                    <li style="float: left;width: 48%">-->
<!--                        <div id="drop_area1"></div>-->
<!--                    </li>-->
                </ul>
            </div>
            <div class="mui-input-row ">
                <label>祛斑前照片:</label>
            </div>
            <div class="mui-input-row " style="height: 180px;">
                <ul style="width: 100%;height: 160px;">
                    <li style="float: left;width: 50%">
                        <div id="drop_area2"></div>
                    </li>
                    <li style="float: left;width: 48%">
                        <div id="drop_area3"></div>
                    </li>
                </ul>
            </div>
                <div class="mui-input-row " style="height: 180px;">
                    <ul style="width: 100%;height: 160px;">

                        <li style="width: 48%;margin-top: 20px;">
                            <div id="drop_area4"></div>
                        </li>
                    </ul>
            </div>
            <div style="width: 100%;display: none;" id="bt">
                <button type="button" class="mui-btn mui-btn-primary" id="save"  style="width: 80%;height: 35px;float: left;margin-left: 10%;margin-top: 20px;">提交资料</button>
            </div>
        </form>


    </div>
    <div class="footerpage">
    </div>
</div>
</body>
<script src="../js/mui.min.js"></script>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/cookieutil.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/getUrlParam.js" type="text/javascript" ></script>
<script src="../uploader/js/uploaderutils.js" type="text/javascript" ></script>
<script>
    $("#bt").attr("style","display:none;");
    imglist="";

    $(function(){
        var hetongimage="";
        $(".headage").load("head.html");
        $(".footerpage").load("footer.html");
        var dragImgUpload0 = new DragImgUpload("#drop_area0",{
            callback:function (files) {
                //回调函数，可以传递给后台等等
                var file = files;
                console.log(file.name);
                saveimg(file,"合同照",0);

                setTimeout(function (){
                    hetongimage=imglist;
                    console.log(hetongimage);
                    console.log(imglist);
                }, 1000);
            }
        })
    //     var dragImgUpload1 = new DragImgUpload("#drop_area1",{
    //         callback:function (files) {
    //         //回调函数，可以传递给后台等等
    //         var file = files;
    //         console.log(file.name);
    //         saveimg(file,"合同照");
    //         setTimeout(function (){
    //             hetongimages=imglist;
    //             imglist="";
    //             console.log(hetongimages);
    //             console.log(imglist);
    //         }, 2000);
    //
    //     }
    // })

        var dragImgUpload2= new DragImgUpload("#drop_area2",{
            callback:function (files) {
                imglist="";
                console.log(imglist);
                //回调函数，可以传递给后台等等
                var file = files;
                console.log(file.name);
                saveimg(file,"祛斑照",0);
            }
        })
        var dragImgUpload13= new DragImgUpload("#drop_area3",{
            callback:function (files) {
                //回调函数，可以传递给后台等等
                var file = files;
                console.log(file.name);
                saveimg(file,"祛斑照",1);

            }
        })
        var dragImgUpload4 = new DragImgUpload("#drop_area4",{
            callback:function (files) {
                //回调函数，可以传递给后台等等
                var file = files;
                console.log(file.name);
                saveimg(file,"祛斑照",2);
                setTimeout(function(){
                    //这里写时间到后执行的代码
                    $("#bt").attr("style","display:block;");
                }, 2000);
            }
        })
        /*公共部分
         * 导航栏
         * footer CopyRight
         */

        $("#save").click(function () {
            var totalprice = $("#totalprice").val();
            if (totalprice == "" || totalprice == undefined) {
                mui.toast('请输入合同金额！');
                return;
            }
            if (hetongimage==null||hetongimage==undefined||hetongimage=="")
            {
                mui.toast('请你选择合同图片！');
                return;
            }
            if (imglist==null||imglist==undefined||imglist=="")
            {
                mui.toast('请你选择祛斑前图片！');
                return;
            }
            var id=getUrlParam("id");
            mui.post('/Order/updateOrderFull',
                {
                    id:id,
                    preimages:imglist,
                    totalprice:totalprice,
                    hetongimages:hetongimage
                },
                function(data){
                    console.log(data);
                    if (data.code){
                        mui.toast('资料提交成功请你等待用户支付尾款！');
                        window.location.href=document.referrer;
                    }
                },'json'
            )
        })
        function onBridgeReady() {
            WeixinJSBridge.call('hideOptionMenu');
        }

        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        } else {
            onBridgeReady();
        }

    });
</script>

</html>